﻿<%@ Page Language="C#" MasterPageFile="~/Layouts/List.Master" AutoEventWireup="true"
    Inherits="HHMMS.UI.Modules.SysParameter.SysParameterList" Title="系统参数列表" CodeBehind="SysParameterList.aspx.cs" %>

<asp:Content ContentPlaceHolderID="head" ID="idFormTitle" runat="server">
    <!-- title -->
</asp:Content>

<asp:Content ID="idContent" ContentPlaceHolderID="Content" runat="Server">   
    <!-- 搜索框 -->
	<div class="search" style="margin-top:2px;">        
        <web:search ID="GridSearch" GridViewId="SmartGridView1" runat="server">            
            <SearchConditionTemplate>                                       
                <table cellpadding="0" cellspacing="0" width="95%">
			        <tr>
                        <th>
                            姓名：
                        </th>
	                    <td>
		                    <asp:TextBox ID="UserName" runat="server" ></asp:TextBox>
	                    </td>
                        <th>
                            账号：
                        </th>
	                    <td>
		                    <asp:TextBox ID="LoginId" runat="server"></asp:TextBox>
	                    </td>               
                    </tr>			            
                </table>
            </SearchConditionTemplate>                      
        </web:search>
    </div>

    <div class="datalist">
	    <!-- 标题头 -->
	    <h2 style="height:30px;">
				    系统参数列表
	    </h2>
	    <!-- 工具栏 -->
	    <div class="toolbar"  style="height:30px;">
            <asp:LinkButton runat="server"
                OnClientClick="return openEditor(this, 'Insert');" OnClick="SearchGrid">
                <span>
                    <img alt="" runat="server" src="~/Images/icon_new.gif" style="border: 0px" />新建
                </span>
            </asp:LinkButton>
	    </div>
	    <div class="datagrid"  style="clear:left;">    
            <!--------------------------- List Area --------------------------->
            <web:SmartGridView ID="SmartGridView1" runat="server" AutoGenerateColumns="False"
                Width="100%" DataKeyNames="ParamCode" DataSourceID="SmartDataSource1" PageSize="10">
                <Columns>            
                    <asp:BoundField DataField="ParamName" HeaderText="参数名称" ItemStyle-Width="130px" SortExpression="ParamName" />
                    <asp:BoundField DataField="ParamValue" HeaderText="参数值" SortExpression="ParamValue" />
                    <asp:BoundField DataField="Remark" HeaderText="描述" SortExpression="Remark" />                                  
                    <asp:TemplateField HeaderText="操作">
                        <ItemStyle HorizontalAlign="Center" />
                        <HeaderStyle Wrap="False" HorizontalAlign="Center" />
                        <ItemTemplate>
                            <table width="46px">
                                <tr>                                    
                                    <td style="border: 0px solid #fff;">
                                        <asp:ImageButton runat="server" ToolTip="编辑" _ParamCode='<%#Eval("ParamCode")%>'
                                            ImageUrl="~/images/com/dg_edit.gif" CausesValidation="False" OnClientClick="return openEditor(this, 'Edit');" OnClick="RefreshGrid">
                                        </asp:ImageButton>
                                    </td>
                                    <td style="border: 0px solid #fff;">
                                        <asp:ImageButton runat="server" ToolTip="删除" ImageUrl="~/images/com/dg_del.gif" _ParamCode='<%#Eval("ParamCode")%>'
                                            CausesValidation="False" OnClientClick="return confirm('您确认要删除吗?')" OnClick="DeleteUser">
                                        </asp:ImageButton>
                                    </td>
                                </tr>
                            </table>
                        </ItemTemplate>
                    </asp:TemplateField>
                </Columns>
                <PagerSettings />
                <EditRowStyle HorizontalAlign="Center" />
            </web:SmartGridView>
    
            <web:SmartSqlDataSource ID="SmartDataSource1" runat="server" SelectCommand="psims.sys_parameters.list" SelectCountCommand="psims.sys_parameters.list.count"
                    DefaultSortExpression="OrderIndex DESC" SelectCommandAutoPageWrap="true">
            </web:SmartSqlDataSource>
        </div>
	</div>

    <script type="text/javascript">
        function openEditor(_this, action) {
            var url;

            // FormViewMode : Insert/Edit/ReadOnly
            var params = {FormViewMode: action }
            if (action == "Insert") {
                url = "SysParameterEdit.aspx";
                params.title = "系统参数新增";
            } else if (action == "Edit") {
                url = "SysParameterEdit.aspx";
                params.title = "系统参数编辑";
                params.ParamCode = _this.attributes["_ParamCode"].value;
            } 
            var returnValue = showCenterModalDialog(buildUrl(url, params), 620, 300, null);
            return returnValue == "true";
        }       
    </script>

</asp:Content>